Objective To quantify the contributions of prevention and treatment to the trends in mortality due to coronary heart disease in Scotland.Design Retrospective analysis using IMPACTSEC, a previously validated policy model, to apportion the recent decline in coronary heart disease mortality to changes in major cardiovascular risk factors and to increases in more than 40 treatments in nine non-overlapping groups of patients.Setting Scotland.Participants All adults aged 25 years or over, stratified by sex, age group, and fifths of Scottish Index of Multiple Deprivation.Main outcome measure Deaths prevented or postponed.Results 5770 fewer deaths from coronary heart disease occurred in 2010 than would be expected if the 2000 mortality rates had persisted (8042 rather than 13 813). This reflected a 43% fall in coronary heart disease mortality rates (from 262 to 148 deaths per 100 000). Improved treatments accounted for approximately 43% (95% confidence interval 33% to 61%) of the fall in mortality, and this benefit was evenly distributed across deprivation fifths. Notable treatment contributions came from primary prevention for hypercholesterolaemia (13%), secondary prevention drugs (11%), and chronic angina treatments (7%). Risk factor improvements accounted for approximately 39% (28% to 49%) of the fall in mortality (44% in the most deprived fifth compared with only 36% in the most affluent fifth). Reductions in systolic blood pressure contributed more than one third (37%) of the decline in mortality, with no socioeconomic patterning. Smaller contributions came from falls in total cholesterol (9%), smoking (4%), and inactivity (2%). However, increases in obesity and diabetes offset some of these benefits, potentially increasing mortality by 4% and 8% respectively. Diabetes showed strong socioeconomic patterning (12% increase in the most deprived fifth compared with 5% for the most affluent fifth).Conclusions Increases in medical treatments accounted for almost half of the large recent decline in mortality due to coronary heart disease in Scotland. Furthermore, the Scottish National Health Service seems to have delivered these benefits equitably. However, the substantial contributions from population falls in blood pressure and other risk factors were diminished by adverse trends in obesity and diabetes. Additional population-wide interventions are urgently needed to reduce coronary heart disease mortality and inequalities in future decades.